﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;
using System.Data;

namespace ConfExpert.Forms.Araclar
{
    public partial class DocsNode : XForm
    {
        int DocsId;
        public DocsNode(int DocsId)
        {
            InitializeComponent();
            this.DocsId = DocsId;
        }

        private void DocsNode_Load(object sender, EventArgs e)
        {
            gleCustomer.Properties.Assign(RI(Rp.V_Customer));
            gleBrand.Properties.Assign(RI(Rp.Brand));
            btn.Click += btn_Click;
            this.Shown += DocsNode_Shown;

            gleBrand.Enabled = gleCustomer.Enabled = ytk(74);
        }

        void DocsNode_Shown(object sender, EventArgs e)
        {
            txtDiger.Focus();
        }

        public DataTable dt;
        void btn_Click(object sender, EventArgs e)
        {
            string Name = txtDiger.Text.Trim();
            if (Name == string.Empty)
                Name = gleBrand.Text;
            if (Name == string.Empty)
                Name = gleCustomer.Text;

            if (Name != string.Empty)
            {
                dt = ExecuteDataTable("InsDocsNode", DocsId, Name, txtAciklama.Text, deTarih.DateTime);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }
    }
}
